package com.cn.wanxi.service;

import com.cn.wanxi.model.NavModel;

import java.util.ArrayList;
import java.util.List;

public class NavService {
    /**
     * 得到导航集合
     *
     * @return
     */
    public List<NavModel> getNavList() {
        NavModel navModel = new NavModel();//获取导航model数组
        String[] titles = navModel.getTitles();
        String[] hrefs = navModel.getHrefs();
        List<NavModel> list = new ArrayList<>();//创建一个空的集合，用于存放navModel对象
        for (int i = 0; i < titles.length; i++) {
            NavModel model = new NavModel();//封装导航数据
//            set方法就是设置value
            model.setHref(hrefs[i]);//赋值
            model.setTitle(titles[i]);//赋值
            list.add(model);
        }
        return list;
    }
}
